<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<div>
			我是index网页
		</div>
		<a href="/cc">123</a>
		<a href="/456">456</a>
		<a href="/678">678</a>
		<button id="back">back</button>
	</body>
	<script src="js/history.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		function changeColer(color){
			document.querySelector("body").style.backgroundColor = color;
		}
		let routers = new Routers();
		routers.init(location.pathname);
		routers.router("/cc",function(){
			changeColer("yellow");
		})
		routers.router("/456",function(){
			changeColer("blue");
		})
		routers.router("/678",function(){
			changeColer("red");
		});
		document.querySelectorAll("a").forEach(function(item){
			item.onclick=function(e){
				e.preventDefault();
				routers.go(e.target.getAttribute("href"));
			}
		})
		/* document.getElementById("back").onclick = function(){
			routers.backoff();
		} */
	</script>
</html>
